﻿#include "helpfile.h"
#include "ui_helpfile.h"

helpfile::helpfile(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::helpfile)
{
    ui->setupUi(this);
    textwrite();
    this->setAttribute(Qt::WA_QuitOnClose, false);
}

helpfile::~helpfile()
{
    delete ui;
}

void helpfile::textwrite(){
    QFile file(":/html/help/help.html");
    if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
        // 处理文件打开失败的情况
        qWarning() << "Failed to open file for reading";
    }

    QTextStream in(&file);
    in.setCodec("UTF-8");
    QString htmlContent = in.readAll();

    file.close();
    ui->textEdit->setHtml(htmlContent);
}

void helpfile::on_pushButton_clicked()
{
    this->close();
}
